package com.hllxd.hism.star.basic.service.constant.alarm;

/**
 * @description 告警方式枚举
 * @author wuguangxi
 * @date 2021/12/30 10:36
 **/
public enum AlarmTypeEnum {

    EXIST("01告警", 1),
    ABSOLUTE_VALUE("绝对值告警", 2),
    //    WAVE_VALUE("波动值告警", 3),
    SUM_VALUE("累计值", 4),
    THRESHOLD("阈值告警", 5);

    private final String name;

    private final Integer code;

    AlarmTypeEnum(String name, Integer code){
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public static AlarmTypeEnum getEnumByCode(Integer code){
        for(AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()){
            if(alarmTypeEnum.getCode().equals(code)){
                return alarmTypeEnum;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code){
        for(AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()){
            if(alarmTypeEnum.getCode().equals(code)){
                return alarmTypeEnum.getName();
            }
        }
        return null;
    }
}
